Remove SmartPointer.h
This commit is contained in:
parent
45f88fe58c
commit
63a5b5c431
|
@ -66,7 +66,6 @@
|
||||||
<ClInclude Include="path.h" />
|
<ClInclude Include="path.h" />
|
||||||
<ClInclude Include="Platform.h" />
|
<ClInclude Include="Platform.h" />
|
||||||
<ClInclude Include="Random.h" />
|
<ClInclude Include="Random.h" />
|
||||||
<ClInclude Include="SmartPointer.h" />
|
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="StdString.h" />
|
<ClInclude Include="StdString.h" />
|
||||||
<ClInclude Include="stdtypes.h" />
|
<ClInclude Include="stdtypes.h" />
|
||||||
|
|
|
@ -91,9 +91,6 @@
|
||||||
<ClInclude Include="path.h">
|
<ClInclude Include="path.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="SmartPointer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="StdString.h">
|
<ClInclude Include="StdString.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// The template class definition for smart pointer
|
|
||||||
template<class _Ty>
|
|
||||||
class AUTO_PTR
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef _Ty element_type;
|
|
||||||
// CTOR
|
|
||||||
explicit AUTO_PTR(_Ty *pVal = 0) throw() :
|
|
||||||
m_Owns(pVal != 0),
|
|
||||||
m_AutoPtr(pVal)
|
|
||||||
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy CTOR
|
|
||||||
AUTO_PTR(const AUTO_PTR<_Ty>& ptrCopy) throw() :
|
|
||||||
m_Owns(ptrCopy.m_Owns),
|
|
||||||
m_AutoPtr(ptrCopy.release())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overloading = operator
|
|
||||||
AUTO_PTR<_Ty>& operator=(AUTO_PTR<_Ty>& ptrCopy) throw()
|
|
||||||
{
|
|
||||||
if (this != &ptrCopy)
|
|
||||||
{
|
|
||||||
if (m_AutoPtr != ptrCopy.get())
|
|
||||||
{
|
|
||||||
if (m_Owns)
|
|
||||||
{
|
|
||||||
delete m_AutoPtr;
|
|
||||||
}
|
|
||||||
m_Owns = ptrCopy.m_Owns;
|
|
||||||
}
|
|
||||||
else if (ptrCopy.m_Owns)
|
|
||||||
{
|
|
||||||
m_Owns = true;
|
|
||||||
}
|
|
||||||
m_AutoPtr = ptrCopy.release();
|
|
||||||
}
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
// DTOR
|
|
||||||
~AUTO_PTR()
|
|
||||||
{
|
|
||||||
if (m_Owns)
|
|
||||||
{
|
|
||||||
delete m_AutoPtr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Overloading * operator
|
|
||||||
_Ty& operator*() const throw()
|
|
||||||
{
|
|
||||||
return (*get());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overloading -> operator
|
|
||||||
_Ty *operator->() const throw()
|
|
||||||
{
|
|
||||||
return (get());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to get the pointer to the class
|
|
||||||
_Ty *get() const throw()
|
|
||||||
{
|
|
||||||
return (m_AutoPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to get the pointer to the class and take ownership
|
|
||||||
_Ty *release() const throw()
|
|
||||||
{
|
|
||||||
((AUTO_PTR<_Ty> *)this)->m_Owns = false;
|
|
||||||
return (m_AutoPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset(_Ty *pVal = 0) throw()
|
|
||||||
{
|
|
||||||
if (m_AutoPtr != pVal)
|
|
||||||
{
|
|
||||||
if (m_Owns)
|
|
||||||
{
|
|
||||||
delete m_AutoPtr;
|
|
||||||
}
|
|
||||||
m_AutoPtr = pVal;
|
|
||||||
m_Owns = pVal != NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
_Ty * m_AutoPtr;
|
|
||||||
bool m_Owns;
|
|
||||||
};
|
|
|
@ -15,5 +15,4 @@
|
||||||
#include "TraceModulesCommon.h"
|
#include "TraceModulesCommon.h"
|
||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "SmartPointer.h"
|
|
||||||
#include "SyncEvent.h"
|
#include "SyncEvent.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
// Copyright(C) 2015 Bobby Smiles
|
// Copyright(C) 2015 Bobby Smiles
|
||||||
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Common/SmartPointer.h>
|
|
||||||
#include "GBCart.h"
|
#include "GBCart.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -683,9 +682,9 @@ static const struct parsed_cart_type* parse_cart_type(uint8_t cart_type)
|
||||||
bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
bool GBCart::init_gb_cart(struct gb_cart* gb_cart, const char* gb_file)
|
||||||
{
|
{
|
||||||
const struct parsed_cart_type* type;
|
const struct parsed_cart_type* type;
|
||||||
AUTO_PTR<uint8_t> rom;
|
std::unique_ptr<uint8_t> rom;
|
||||||
size_t rom_size = 0;
|
size_t rom_size = 0;
|
||||||
AUTO_PTR<uint8_t> ram;
|
std::unique_ptr<uint8_t> ram;
|
||||||
size_t ram_size = 0;
|
size_t ram_size = 0;
|
||||||
CFile tempFile;
|
CFile tempFile;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "SystemGlobals.h"
|
#include "SystemGlobals.h"
|
||||||
#include <Common/md5.h>
|
#include <Common/md5.h>
|
||||||
#include <Common/Platform.h>
|
#include <Common/Platform.h>
|
||||||
#include <Common/SmartPointer.h>
|
|
||||||
#include <Common/MemoryManagement.h>
|
#include <Common/MemoryManagement.h>
|
||||||
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
#include <Project64-core/N64System/Mips/RegisterClass.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -236,7 +235,7 @@ void CN64Disk::ClearDiskSettingID()
|
||||||
bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
|
bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk");
|
||||||
AUTO_PTR<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]);
|
std::unique_ptr<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]);
|
||||||
if (ImageBase.get() == NULL)
|
if (ImageBase.get() == NULL)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
@ -256,7 +255,7 @@ bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
|
||||||
bool CN64Disk::AllocateDiskHeader()
|
bool CN64Disk::AllocateDiskHeader()
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge");
|
||||||
AUTO_PTR<uint8_t> HeaderBase(new uint8_t[0x40 + 0x1000]);
|
std::unique_ptr<uint8_t> HeaderBase(new uint8_t[0x40 + 0x1000]);
|
||||||
if (HeaderBase.get() == NULL)
|
if (HeaderBase.get() == NULL)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <Common/md5.h>
|
#include <Common/md5.h>
|
||||||
#include <Common/Platform.h>
|
#include <Common/Platform.h>
|
||||||
#include <Common/MemoryManagement.h>
|
#include <Common/MemoryManagement.h>
|
||||||
#include <Common/SmartPointer.h>
|
|
||||||
#include <Common/IniFileClass.h>
|
#include <Common/IniFileClass.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ CN64Rom::~CN64Rom()
|
||||||
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom");
|
||||||
AUTO_PTR<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
std::unique_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x2000]);
|
||||||
if (ImageBase.get() == NULL)
|
if (ImageBase.get() == NULL)
|
||||||
{
|
{
|
||||||
SetError(MSG_MEM_ALLOC_ERROR);
|
SetError(MSG_MEM_ALLOC_ERROR);
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <png/png.h>
|
#include <png/png.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <Common/SmartPointer.h>
|
|
||||||
#include <Settings/Settings.h>
|
#include <Settings/Settings.h>
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
@ -1167,7 +1166,7 @@ void newSwapBuffers()
|
||||||
info.size = sizeof(gfxLfbInfo_t);
|
info.size = sizeof(gfxLfbInfo_t);
|
||||||
if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GFX_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, false, &info))
|
if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GFX_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, false, &info))
|
||||||
{
|
{
|
||||||
AUTO_PTR<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]);
|
std::unique_ptr<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]);
|
||||||
uint8_t * ssimg = ssimg_buffer.get();
|
uint8_t * ssimg = ssimg_buffer.get();
|
||||||
int sspos = 0;
|
int sspos = 0;
|
||||||
uint32_t offset_src = info.strideInBytes * offset_y;
|
uint32_t offset_src = info.strideInBytes * offset_y;
|
||||||
|
|
|
@ -9,6 +9,5 @@
|
||||||
#include <Common/LogClass.h>
|
#include <Common/LogClass.h>
|
||||||
#include <Common/Trace.h>
|
#include <Common/Trace.h>
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
#include <Common/SmartPointer.h>
|
|
||||||
#include <Common/IniFileClass.h>
|
#include <Common/IniFileClass.h>
|
||||||
#include <Common/md5.h>
|
#include <Common/md5.h>
|
||||||
|
|
Loading…
Reference in New Issue