- atempt to cleanup use fo auto_ptr
This commit is contained in:
parent
d82aaa22ad
commit
86a59859b9
|
@ -25,14 +25,12 @@
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <platform_util.h>
|
#include <platform_util.h>
|
||||||
//#include "interpolation.h"
|
#include "common_scoped_ptr.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <wx/filename.h>
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
|
@ -452,7 +450,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
DWORD dwDisposition;
|
DWORD dwDisposition;
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
||||||
//Set the value.
|
//Set the value.
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||||
|
|
||||||
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
|
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
|
||||||
DWORD len = (DWORD)launchApp.length() + 1;
|
DWORD len = (DWORD)launchApp.length() + 1;
|
||||||
|
@ -851,7 +849,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||||
file = utf8_encode(wstr.get());
|
file = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
|
@ -886,7 +884,7 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||||
file = utf8_encode(wstr.get());
|
file = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
|
@ -920,7 +918,7 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||||
file = utf8_encode(wstr.get());
|
file = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
|
@ -955,7 +953,7 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||||
file = tmp_buf;
|
file = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||||
file = utf8_encode(wstr.get());
|
file = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||||
|
@ -2160,7 +2158,7 @@ bool App::OnInit() {
|
||||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
||||||
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2205,14 +2203,14 @@ bool App::OnInit() {
|
||||||
if(delimitedList.size() >= 2) {
|
if(delimitedList.size() >= 2) {
|
||||||
unitToLoad.first = delimitedList[0];
|
unitToLoad.first = delimitedList[0];
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(unitToLoad.first.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(unitToLoad.first.c_str()));
|
||||||
unitToLoad.first = utf8_encode(wstr.get());
|
unitToLoad.first = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int i = 1; i < delimitedList.size(); ++i) {
|
for(unsigned int i = 1; i < delimitedList.size(); ++i) {
|
||||||
string value = delimitedList[i];
|
string value = delimitedList[i];
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||||
value = utf8_encode(wstr.get());
|
value = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2251,7 +2249,7 @@ bool App::OnInit() {
|
||||||
string customPathValue = paramPartTokens[1];
|
string customPathValue = paramPartTokens[1];
|
||||||
modelPath = customPathValue;
|
modelPath = customPathValue;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
||||||
modelPath = utf8_encode(wstr.get());
|
modelPath = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2281,7 +2279,7 @@ bool App::OnInit() {
|
||||||
string customPathValue = paramPartTokens[1];
|
string customPathValue = paramPartTokens[1];
|
||||||
particlePath = customPathValue;
|
particlePath = customPathValue;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(particlePath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(particlePath.c_str()));
|
||||||
particlePath = utf8_encode(wstr.get());
|
particlePath = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2309,7 +2307,7 @@ bool App::OnInit() {
|
||||||
string customPathValue = paramPartTokens[1];
|
string customPathValue = paramPartTokens[1];
|
||||||
projectileParticlePath = customPathValue;
|
projectileParticlePath = customPathValue;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(projectileParticlePath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(projectileParticlePath.c_str()));
|
||||||
projectileParticlePath = utf8_encode(wstr.get());
|
projectileParticlePath = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2337,7 +2335,7 @@ bool App::OnInit() {
|
||||||
string customPathValue = paramPartTokens[1];
|
string customPathValue = paramPartTokens[1];
|
||||||
splashParticlePath = customPathValue;
|
splashParticlePath = customPathValue;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(splashParticlePath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(splashParticlePath.c_str()));
|
||||||
splashParticlePath = utf8_encode(wstr.get());
|
splashParticlePath = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2496,7 +2494,7 @@ bool App::OnInit() {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
|
||||||
modelPath = tmp_buf;
|
modelPath = tmp_buf;
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
||||||
modelPath = utf8_encode(wstr.get());
|
modelPath = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
modelPath = wxFNCONV(argv[1]);
|
modelPath = wxFNCONV(argv[1]);
|
||||||
|
@ -2526,7 +2524,7 @@ bool App::OnInit() {
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||||
string appPath = tmp_buf;
|
string appPath = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||||
appPath = utf8_encode(wstr.get());
|
appPath = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
string appPath(wxFNCONV(exe_path));
|
string appPath(wxFNCONV(exe_path));
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "auto_test.h"
|
#include "auto_test.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "interpolation.h"
|
#include "interpolation.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
|
|
||||||
// To handle signal catching
|
// To handle signal catching
|
||||||
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
||||||
|
@ -128,7 +129,7 @@ static string runtimeErrorMsg = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GOOGLE_BREAKPAD
|
#ifdef HAVE_GOOGLE_BREAKPAD
|
||||||
std::auto_ptr<google_breakpad::ExceptionHandler> errorHandlerPtr;
|
unique_ptr<google_breakpad::ExceptionHandler> errorHandlerPtr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class NavtiveLanguageNameListCacheGenerator : public SimpleTaskCallbackInterface {
|
class NavtiveLanguageNameListCacheGenerator : public SimpleTaskCallbackInterface {
|
||||||
|
@ -5554,8 +5555,8 @@ int glestMain(int argc, char** argv) {
|
||||||
preCacheThread->start();
|
preCacheThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::auto_ptr<NavtiveLanguageNameListCacheGenerator> lngCacheGen;
|
unique_ptr<NavtiveLanguageNameListCacheGenerator> lngCacheGen;
|
||||||
std::auto_ptr<SimpleTaskThread> languageCacheGen;
|
unique_ptr<SimpleTaskThread> languageCacheGen;
|
||||||
|
|
||||||
bool startNativeLanguageNamesPrecacheThread = config.getBool("PreCacheNativeLanguageNamesThread","true");
|
bool startNativeLanguageNamesPrecacheThread = config.getBool("PreCacheNativeLanguageNamesThread","true");
|
||||||
if(startNativeLanguageNamesPrecacheThread == true &&
|
if(startNativeLanguageNamesPrecacheThread == true &&
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
#include "map_preview.h"
|
#include "map_preview.h"
|
||||||
#include "miniftpclient.h"
|
#include "miniftpclient.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Shared { namespace Graphics {
|
namespace Shared { namespace Graphics {
|
||||||
|
@ -242,7 +243,7 @@ private:
|
||||||
|
|
||||||
bool launchingNewGame;
|
bool launchingNewGame;
|
||||||
bool isfirstSwitchingMapMessage;
|
bool isfirstSwitchingMapMessage;
|
||||||
std::auto_ptr<TechTree> techTree;
|
unique_ptr<TechTree> techTree;
|
||||||
|
|
||||||
GameSettings originalGamesettings;
|
GameSettings originalGamesettings;
|
||||||
bool validOriginalGameSettings;
|
bool validOriginalGameSettings;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "chat_manager.h"
|
#include "chat_manager.h"
|
||||||
#include "simple_threads.h"
|
#include "simple_threads.h"
|
||||||
#include "map_preview.h"
|
#include "map_preview.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Map;
|
using namespace Shared::Map;
|
||||||
|
@ -218,7 +219,7 @@ private:
|
||||||
bool masterserverModeMinimalResources;
|
bool masterserverModeMinimalResources;
|
||||||
int lastMasterServerSettingsUpdateCount;
|
int lastMasterServerSettingsUpdateCount;
|
||||||
|
|
||||||
std::auto_ptr<TechTree> techTree;
|
unique_ptr<TechTree> techTree;
|
||||||
|
|
||||||
string gameUUID;
|
string gameUUID;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ namespace Glest{ namespace Game{
|
||||||
|
|
||||||
bool NetworkMessage::useOldProtocol = true;
|
bool NetworkMessage::useOldProtocol = true;
|
||||||
|
|
||||||
auto_ptr<Mutex> NetworkMessage::mutexMessageStats(new Mutex(CODE_AT_LINE));
|
unique_ptr<Mutex> NetworkMessage::mutexMessageStats(new Mutex(CODE_AT_LINE));
|
||||||
Chrono NetworkMessage::statsTimer;
|
Chrono NetworkMessage::statsTimer;
|
||||||
Chrono NetworkMessage::lastSend;
|
Chrono NetworkMessage::lastSend;
|
||||||
Chrono NetworkMessage::lastRecv;
|
Chrono NetworkMessage::lastRecv;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "network_types.h"
|
#include "network_types.h"
|
||||||
#include "byte_order.h"
|
#include "byte_order.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using Shared::Platform::Socket;
|
using Shared::Platform::Socket;
|
||||||
|
@ -98,7 +98,7 @@ enum NetworkMessageStatisticType {
|
||||||
class NetworkMessage {
|
class NetworkMessage {
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static auto_ptr<Mutex> mutexMessageStats;
|
static unique_ptr<Mutex> mutexMessageStats;
|
||||||
static Chrono statsTimer;
|
static Chrono statsTimer;
|
||||||
static Chrono lastSend;
|
static Chrono lastSend;
|
||||||
static Chrono lastRecv;
|
static Chrono lastRecv;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "platform_util.h"
|
#include "platform_util.h"
|
||||||
#include "game_util.h"
|
#include "game_util.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
@ -176,7 +177,7 @@ Checksum TechTree::loadTech(const string &techName,
|
||||||
|
|
||||||
bool TechTree::exists(const string &techName, const vector<string> &pathTechList) {
|
bool TechTree::exists(const string &techName, const vector<string> &pathTechList) {
|
||||||
bool techFound = false;
|
bool techFound = false;
|
||||||
std::auto_ptr<TechTree> techTree(new TechTree(pathTechList));
|
unique_ptr<TechTree> techTree(new TechTree(pathTechList));
|
||||||
string path = techTree->findPath(techName);
|
string path = techTree->findPath(techName);
|
||||||
if(path != "") {
|
if(path != "") {
|
||||||
techFound = true;
|
techFound = true;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "game_util.h"
|
#include "game_util.h"
|
||||||
#include "unit_particle_type.h"
|
#include "unit_particle_type.h"
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
using namespace Shared::Xml;
|
using namespace Shared::Xml;
|
||||||
|
@ -36,7 +37,7 @@ using namespace Shared::Util;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
auto_ptr<CommandType> UnitType::ctHarvestEmergencyReturnCommandType(new HarvestEmergencyReturnCommandType());
|
unique_ptr<CommandType> UnitType::ctHarvestEmergencyReturnCommandType(new HarvestEmergencyReturnCommandType());
|
||||||
// ===============================
|
// ===============================
|
||||||
// class Level
|
// class Level
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
#include "platform_common.h"
|
#include "platform_common.h"
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
@ -233,7 +234,7 @@ private:
|
||||||
|
|
||||||
UnitCountsInVictoryConditions countInVictoryConditions;
|
UnitCountsInVictoryConditions countInVictoryConditions;
|
||||||
|
|
||||||
static auto_ptr<CommandType> ctHarvestEmergencyReturnCommandType;
|
static unique_ptr<CommandType> ctHarvestEmergencyReturnCommandType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//creation and loading
|
//creation and loading
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
@ -689,7 +690,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
|
||||||
currentFile = tmp_buf;
|
currentFile = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||||
currentFile = utf8_encode(wstr.get());
|
currentFile = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
//currentFile = fileDialog->GetPath().ToAscii();
|
//currentFile = fileDialog->GetPath().ToAscii();
|
||||||
|
@ -765,7 +766,7 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) {
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
|
||||||
currentFile = tmp_buf;
|
currentFile = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||||
currentFile = utf8_encode(wstr.get());
|
currentFile = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
//currentFile = fd.GetPath().ToAscii();
|
//currentFile = fd.GetPath().ToAscii();
|
||||||
|
@ -1638,7 +1639,7 @@ bool App::OnInit() {
|
||||||
fileparam = tmp_buf;
|
fileparam = tmp_buf;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(fileparam.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(fileparam.c_str()));
|
||||||
fileparam = utf8_encode(wstr.get());
|
fileparam = utf8_encode(wstr.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1663,7 +1664,7 @@ bool App::OnInit() {
|
||||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||||
appPath = tmp_buf;
|
appPath = tmp_buf;
|
||||||
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
unique_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||||
appPath = utf8_encode(wstr.get());
|
appPath = utf8_encode(wstr.get());
|
||||||
#else
|
#else
|
||||||
appPath = wxFNCONV(exe_path);
|
appPath = wxFNCONV(exe_path);
|
||||||
|
|
|
@ -663,20 +663,12 @@ void Program::loadMap(const string &path) {
|
||||||
redoStack.clear();
|
redoStack.clear();
|
||||||
|
|
||||||
std::string encodedPath = path;
|
std::string encodedPath = path;
|
||||||
//#ifdef WIN32
|
|
||||||
// std::auto_ptr<wchar_t> wstr(Ansi2WideString(path.c_str()));
|
|
||||||
// encodedPath = utf8_encode(wstr.get());
|
|
||||||
//#endif
|
|
||||||
map->loadFromFile(encodedPath);
|
map->loadFromFile(encodedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::saveMap(const string &path) {
|
void Program::saveMap(const string &path) {
|
||||||
if(map) {
|
if(map) {
|
||||||
std::string encodedPath = path;
|
std::string encodedPath = path;
|
||||||
//#ifdef WIN32
|
|
||||||
// std::auto_ptr<wchar_t> wstr(Ansi2WideString(path.c_str()));
|
|
||||||
// encodedPath = utf8_encode(wstr.get());
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
map->saveToFile(encodedPath);
|
map->saveToFile(encodedPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "model_header.h"
|
#include "model_header.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
#include "byte_order.h"
|
#include "byte_order.h"
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
@ -314,7 +315,7 @@ private:
|
||||||
|
|
||||||
static vector<vector<unsigned char> > nextColorIDReuseList;
|
static vector<vector<unsigned char> > nextColorIDReuseList;
|
||||||
|
|
||||||
static auto_ptr<PixelBufferWrapper> pbo;
|
static unique_ptr<PixelBufferWrapper> pbo;
|
||||||
|
|
||||||
void assign_color();
|
void assign_color();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
// ==============================================================
|
||||||
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _COMMON_SCOPED_PTR_H_
|
||||||
|
#define _COMMON_SCOPED_PTR_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class Thread
|
||||||
|
// =====================================================
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#if !defined(HAVE_CXX11) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||||
|
#define unique_ptr auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -19,6 +19,7 @@
|
||||||
#include <SDL_mutex.h>
|
#include <SDL_mutex.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include "common_scoped_ptr.h"
|
||||||
|
|
||||||
#include "data_types.h"
|
#include "data_types.h"
|
||||||
#ifdef DEBUG_PERFORMANCE_MUTEXES
|
#ifdef DEBUG_PERFORMANCE_MUTEXES
|
||||||
|
@ -69,7 +70,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_Thread* thread;
|
SDL_Thread* thread;
|
||||||
//std::auto_ptr<Mutex> mutexthreadAccessor;
|
//std::unique_ptr<Mutex> mutexthreadAccessor;
|
||||||
Mutex *mutexthreadAccessor;
|
Mutex *mutexthreadAccessor;
|
||||||
ThreadState currentState;
|
ThreadState currentState;
|
||||||
bool threadObjectValid();
|
bool threadObjectValid();
|
||||||
|
@ -128,7 +129,7 @@ private:
|
||||||
Shared::PlatformCommon::Chrono *chronoPerf;
|
Shared::PlatformCommon::Chrono *chronoPerf;
|
||||||
|
|
||||||
bool isStaticMutexListMutex;
|
bool isStaticMutexListMutex;
|
||||||
static auto_ptr<Mutex> mutexMutexList;
|
static unique_ptr<Mutex> mutexMutexList;
|
||||||
static vector<Mutex *> mutexList;
|
static vector<Mutex *> mutexList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1896,7 +1896,7 @@ const unsigned int BaseColorPickEntity::k = 43067;
|
||||||
unsigned int BaseColorPickEntity::nextColorRGB = BaseColorPickEntity::k;
|
unsigned int BaseColorPickEntity::nextColorRGB = BaseColorPickEntity::k;
|
||||||
|
|
||||||
unsigned char BaseColorPickEntity::nextColorID[COLOR_COMPONENTS] = { 1, 1, 1, 0 };
|
unsigned char BaseColorPickEntity::nextColorID[COLOR_COMPONENTS] = { 1, 1, 1, 0 };
|
||||||
auto_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
|
unique_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
|
||||||
|
|
||||||
map<string,bool> BaseColorPickEntity::usedColorIDList;
|
map<string,bool> BaseColorPickEntity::usedColorIDList;
|
||||||
bool BaseColorPickEntity::trackColorUse = true;
|
bool BaseColorPickEntity::trackColorUse = true;
|
||||||
|
@ -2128,7 +2128,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
|
||||||
pickedModels.reserve(rendererModels.size());
|
pickedModels.reserve(rendererModels.size());
|
||||||
|
|
||||||
//printf("In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
//printf("In [%s::%s] Line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
static auto_ptr<Pixmap2D> cachedPixels;
|
static unique_ptr<Pixmap2D> cachedPixels;
|
||||||
|
|
||||||
if(rendererModels.empty() == false) {
|
if(rendererModels.empty() == false) {
|
||||||
if(PixelBufferWrapper::getIsPBOEnable() == true) {
|
if(PixelBufferWrapper::getIsPBOEnable() == true) {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "platform_common.h"
|
#include "platform_common.h"
|
||||||
#include "base_thread.h"
|
#include "base_thread.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -28,15 +27,15 @@ bool Thread::enableVerboseMode = false;
|
||||||
Mutex Thread::mutexthreadList;
|
Mutex Thread::mutexthreadList;
|
||||||
vector<Thread *> Thread::threadList;
|
vector<Thread *> Thread::threadList;
|
||||||
|
|
||||||
auto_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
|
unique_ptr<Mutex> Mutex::mutexMutexList(new Mutex(CODE_AT_LINE));
|
||||||
vector<Mutex *> Mutex::mutexList;
|
vector<Mutex *> Mutex::mutexList;
|
||||||
|
|
||||||
class ThreadGarbageCollector;
|
class ThreadGarbageCollector;
|
||||||
class Mutex;
|
class Mutex;
|
||||||
class MutexSafeWrapper;
|
class MutexSafeWrapper;
|
||||||
|
|
||||||
static auto_ptr<ThreadGarbageCollector> cleanupThread;
|
static unique_ptr<ThreadGarbageCollector> cleanupThread;
|
||||||
static auto_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
|
static unique_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
|
||||||
|
|
||||||
class ThreadGarbageCollector : public BaseThread
|
class ThreadGarbageCollector : public BaseThread
|
||||||
{
|
{
|
||||||
|
@ -547,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());
|
// 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);
|
// throw megaglest_runtime_error(szBuf);
|
||||||
// }
|
// }
|
||||||
// std::auto_ptr<Chrono> chronoLockPerf;
|
// std::unique_ptr<Chrono> chronoLockPerf;
|
||||||
// if(debugMutexLock == true) {
|
// if(debugMutexLock == true) {
|
||||||
// chronoLockPerf.reset(new Chrono());
|
// chronoLockPerf.reset(new Chrono());
|
||||||
// chronoLockPerf->start();
|
// chronoLockPerf->start();
|
||||||
|
|
Loading…
Reference in New Issue