[Project64] Use AUTO_PTR instead of std::auto_ptr

This commit is contained in:
zilmar 2016-10-09 20:44:31 +11:00
parent 97f1d8302d
commit e1633bbada
4 changed files with 480 additions and 482 deletions

View File

@ -47,6 +47,7 @@
#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 "Config.h" #include "Config.h"
#include "Util.h" #include "Util.h"
@ -281,7 +282,7 @@ void ConfigWrapper()
#else #else
g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#endif #endif
); );
} }
void UseUnregisteredSetting(int /*SettingID*/) void UseUnregisteredSetting(int /*SettingID*/)
@ -1093,7 +1094,6 @@ void ReleaseGfx()
rdp.window_changed = TRUE; rdp.window_changed = TRUE;
} }
#ifdef _WIN32 #ifdef _WIN32
CriticalSection * g_ProcessDListCS = NULL; CriticalSection * g_ProcessDListCS = NULL;
@ -1417,7 +1417,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info)
#else #else
g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic
#endif #endif
); );
grGlideInit(); grGlideInit();
grSstSelect(0); grSstSelect(0);
@ -2127,7 +2127,7 @@ void newSwapBuffers()
info.size = sizeof(GrLfbInfo_t); info.size = sizeof(GrLfbInfo_t);
if (grLfbLock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) if (grLfbLock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
{ {
std::auto_ptr<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]); AUTO_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;
@ -2442,4 +2442,4 @@ void Android_JNI_SwapWindow()
{ {
gfx.SwapBuffers(); gfx.SwapBuffers();
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
#include "N64DiskClass.h" #include "N64DiskClass.h"
#include "SystemGlobals.h" #include "SystemGlobals.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>
@ -122,7 +123,7 @@ bool CN64Disk::IsValidDiskImage(uint8_t Test[4])
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");
std::auto_ptr<uint8_t> ImageBase(new uint8_t[DiskFileSize + 0x1000]); AUTO_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);
@ -493,7 +494,7 @@ void CN64Disk::ConvertDiskFormatBack()
//SDK DISK RAM //SDK DISK RAM
WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk SDK format"); WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk SDK format");
std::auto_ptr<uint8_t> ImageBase(new uint8_t[SDKFormatSize + 0x1000]); AUTO_PTR<uint8_t> ImageBase(new uint8_t[SDKFormatSize + 0x1000]);
if (ImageBase.get() == NULL) if (ImageBase.get() == NULL)
{ {
SetError(MSG_MEM_ALLOC_ERROR); SetError(MSG_MEM_ALLOC_ERROR);
@ -515,7 +516,7 @@ void CN64Disk::ConvertDiskFormatBack()
memcpy(&SystemData, m_DiskImage, 0xE8); memcpy(&SystemData, m_DiskImage, 0xE8);
disktype = SystemData[5] & 0xF; disktype = SystemData[5] & 0xF;
//Prepare Input Offsets //Prepare Input Offsets
for (zone = 1; zone < 16; zone++) for (zone = 1; zone < 16; zone++)
{ {
@ -528,7 +529,7 @@ void CN64Disk::ConvertDiskFormatBack()
{ {
OutStart[zone] = OutStart[zone - 1] + ZONESIZE(zone - 1); OutStart[zone] = OutStart[zone - 1] + ZONESIZE(zone - 1);
} }
//Copy Head 0 //Copy Head 0
for (zone = 0; zone < 8; zone++) for (zone = 0; zone < 8; zone++)
{ {
@ -567,7 +568,7 @@ void CN64Disk::ConvertDiskFormatBack()
} }
} }
} }
//Copy Head 1 //Copy Head 1
for (zone = 8; zone < 16; zone++) for (zone = 8; zone < 16; zone++)
{ {
@ -606,13 +607,13 @@ void CN64Disk::ConvertDiskFormatBack()
} }
} }
} }
if (!m_DiskFile.Write(s_DiskImage, SDKFormatSize)) if (!m_DiskFile.Write(s_DiskImage, SDKFormatSize))
{ {
m_DiskFile.Close(); m_DiskFile.Close();
WriteTrace(TraceN64System, TraceError, "Failed to write file"); WriteTrace(TraceN64System, TraceError, "Failed to write file");
} }
WriteTrace(TraceN64System, TraceDebug, "Unallocating disk SDK format memory"); WriteTrace(TraceN64System, TraceDebug, "Unallocating disk SDK format memory");
delete[] s_DiskImageBase; delete[] s_DiskImageBase;
s_DiskImageBase = NULL; s_DiskImageBase = NULL;

View File

@ -15,6 +15,7 @@
#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 <memory> #include <memory>
#ifdef _WIN32 #ifdef _WIN32
@ -38,7 +39,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");
std::auto_ptr<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x1000]); AUTO_PTR<uint8_t> ImageBase(new uint8_t[RomFileSize + 0x1000]);
if (ImageBase.get() == NULL) if (ImageBase.get() == NULL)
{ {
SetError(MSG_MEM_ALLOC_ERROR); SetError(MSG_MEM_ALLOC_ERROR);