[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 <png/png.h>
#include <memory>
#include <Common/SmartPointer.h>
#include "Config.h"
#include "Util.h"
@ -1093,7 +1094,6 @@ void ReleaseGfx()
rdp.window_changed = TRUE;
}
#ifdef _WIN32
CriticalSection * g_ProcessDListCS = NULL;
@ -2127,7 +2127,7 @@ void newSwapBuffers()
info.size = sizeof(GrLfbInfo_t);
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();
int sspos = 0;
uint32_t offset_src = info.strideInBytes * offset_y;

View File

@ -11,6 +11,7 @@
* *
****************************************************************************/
#include "stdafx.h"
#include <Common/SmartPointer.h>
#include "GBCart.h"
#include <time.h>
@ -72,7 +73,6 @@ static void write_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, cons
memcpy(&gb_cart->ram[offset], data, 0x20);
}
}
static void read_gb_cart_mbc1(struct gb_cart* gb_cart, uint16_t address, uint8_t* data)
@ -262,14 +262,13 @@ void memoryUpdateMBC3Clock(struct gb_cart* gb_cart)
}
diff /= 24;
gb_cart->rtc_data[3] += (int)(diff & 0xFFFFFFFF);
if (gb_cart->rtc_data[3] > 255) {
if (gb_cart->rtc_data[3] > 511) {
gb_cart->rtc_data[3] %= 512;
gb_cart->rtc_data[3] |= 0x80;
}
gb_cart->rtc_data[4] = (gb_cart->rtc_data[4] & 0xFE) | (gb_cart->rtc_data[3]>255 ? 1 : 0);
gb_cart->rtc_data[4] = (gb_cart->rtc_data[4] & 0xFE) | (gb_cart->rtc_data[3] > 255 ? 1 : 0);
}
}
gb_cart->rtc_last_time = now;
@ -467,7 +466,6 @@ static void write_gb_cart_mbc5(struct gb_cart* gb_cart, uint16_t address, const
}
}
}
}
static void read_gb_cart_mmm01(struct gb_cart* gb_cart, uint16_t address, uint8_t* data)
@ -654,7 +652,6 @@ static const struct parsed_cart_type* parse_cart_type(uint8_t cart_type)
};
#undef MBC
switch (cart_type)
{
case 0x00: return &GB_CART_TYPES[0];
@ -693,9 +690,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)
{
const struct parsed_cart_type* type;
std::auto_ptr<uint8_t> rom;
AUTO_PTR<uint8_t> rom;
size_t rom_size = 0;
std::auto_ptr<uint8_t> ram;
AUTO_PTR<uint8_t> ram;
size_t ram_size = 0;
CFile tempFile;
@ -822,7 +819,6 @@ void GBCart::release_gb_cart(struct gb_cart* gb_cart)
memset(gb_cart, 0, sizeof(*gb_cart));
}
void GBCart::read_gb_cart(struct gb_cart* gb_cart, uint16_t address, uint8_t* data)
{
gb_cart->read_gb_cart(gb_cart, address, data);

View File

@ -12,6 +12,7 @@
#include "N64DiskClass.h"
#include "SystemGlobals.h"
#include <Common/Platform.h>
#include <Common/SmartPointer.h>
#include <Common/MemoryManagement.h>
#include <Project64-core/N64System/Mips/RegisterClass.h>
#include <memory>
@ -122,7 +123,7 @@ bool CN64Disk::IsValidDiskImage(uint8_t Test[4])
bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize)
{
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)
{
SetError(MSG_MEM_ALLOC_ERROR);
@ -493,7 +494,7 @@ void CN64Disk::ConvertDiskFormatBack()
//SDK DISK RAM
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)
{
SetError(MSG_MEM_ALLOC_ERROR);

View File

@ -15,6 +15,7 @@
#include <Common/md5.h>
#include <Common/Platform.h>
#include <Common/MemoryManagement.h>
#include <Common/SmartPointer.h>
#include <memory>
#ifdef _WIN32
@ -38,7 +39,7 @@ CN64Rom::~CN64Rom()
bool CN64Rom::AllocateRomImage(uint32_t RomFileSize)
{
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)
{
SetError(MSG_MEM_ALLOC_ERROR);