mirror of
https://github.com/glest/glest-source.git
synced 2025-08-26 17:34:24 +02:00
- atempt to cleanup use fo auto_ptr
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "texture.h"
|
||||
#include "model_header.h"
|
||||
#include <memory>
|
||||
#include "common_scoped_ptr.h"
|
||||
#include "byte_order.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
@@ -314,7 +315,7 @@ private:
|
||||
|
||||
static vector<vector<unsigned char> > nextColorIDReuseList;
|
||||
|
||||
static auto_ptr<PixelBufferWrapper> pbo;
|
||||
static unique_ptr<PixelBufferWrapper> pbo;
|
||||
|
||||
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 <string>
|
||||
#include <memory>
|
||||
#include "common_scoped_ptr.h"
|
||||
|
||||
#include "data_types.h"
|
||||
#ifdef DEBUG_PERFORMANCE_MUTEXES
|
||||
@@ -69,7 +70,7 @@ public:
|
||||
|
||||
private:
|
||||
SDL_Thread* thread;
|
||||
//std::auto_ptr<Mutex> mutexthreadAccessor;
|
||||
//std::unique_ptr<Mutex> mutexthreadAccessor;
|
||||
Mutex *mutexthreadAccessor;
|
||||
ThreadState currentState;
|
||||
bool threadObjectValid();
|
||||
@@ -128,7 +129,7 @@ private:
|
||||
Shared::PlatformCommon::Chrono *chronoPerf;
|
||||
|
||||
bool isStaticMutexListMutex;
|
||||
static auto_ptr<Mutex> mutexMutexList;
|
||||
static unique_ptr<Mutex> mutexMutexList;
|
||||
static vector<Mutex *> mutexList;
|
||||
|
||||
public:
|
||||
|
@@ -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 };
|
||||
auto_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
|
||||
unique_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 auto_ptr<Pixmap2D> cachedPixels;
|
||||
static unique_ptr<Pixmap2D> cachedPixels;
|
||||
|
||||
if(rendererModels.empty() == false) {
|
||||
if(PixelBufferWrapper::getIsPBOEnable() == true) {
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include "platform_common.h"
|
||||
#include "base_thread.h"
|
||||
#include "time.h"
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -28,15 +27,15 @@ bool Thread::enableVerboseMode = false;
|
||||
Mutex Thread::mutexthreadList;
|
||||
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;
|
||||
|
||||
class ThreadGarbageCollector;
|
||||
class Mutex;
|
||||
class MutexSafeWrapper;
|
||||
|
||||
static auto_ptr<ThreadGarbageCollector> cleanupThread;
|
||||
static auto_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
|
||||
static unique_ptr<ThreadGarbageCollector> cleanupThread;
|
||||
static unique_ptr<Mutex> cleanupThreadMutex(new Mutex(CODE_AT_LINE));
|
||||
|
||||
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());
|
||||
// throw megaglest_runtime_error(szBuf);
|
||||
// }
|
||||
// std::auto_ptr<Chrono> chronoLockPerf;
|
||||
// std::unique_ptr<Chrono> chronoLockPerf;
|
||||
// if(debugMutexLock == true) {
|
||||
// chronoLockPerf.reset(new Chrono());
|
||||
// chronoLockPerf->start();
|
||||
|
Reference in New Issue
Block a user