diff --git a/Source/Common/Common.vcxproj b/Source/Common/Common.vcxproj index e8ba6cbe8..d2cdc8714 100644 --- a/Source/Common/Common.vcxproj +++ b/Source/Common/Common.vcxproj @@ -66,7 +66,6 @@ - diff --git a/Source/Common/Common.vcxproj.filters b/Source/Common/Common.vcxproj.filters index 69caab164..3837d7667 100644 --- a/Source/Common/Common.vcxproj.filters +++ b/Source/Common/Common.vcxproj.filters @@ -91,9 +91,6 @@ Header Files - - Header Files - Header Files diff --git a/Source/Common/SmartPointer.h b/Source/Common/SmartPointer.h deleted file mode 100644 index 33249c483..000000000 --- a/Source/Common/SmartPointer.h +++ /dev/null @@ -1,94 +0,0 @@ -#pragma once - -// The template class definition for smart pointer -template -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; -}; diff --git a/Source/Common/stdafx.h b/Source/Common/stdafx.h index 47b0edf79..0cedbc40f 100644 --- a/Source/Common/stdafx.h +++ b/Source/Common/stdafx.h @@ -15,5 +15,4 @@ #include "TraceModulesCommon.h" #include "Trace.h" #include "md5.h" -#include "SmartPointer.h" #include "SyncEvent.h" diff --git a/Source/Project64-core/N64System/Mips/GBCart.cpp b/Source/Project64-core/N64System/Mips/GBCart.cpp index 4c4adc4c1..21cabc9eb 100644 --- a/Source/Project64-core/N64System/Mips/GBCart.cpp +++ b/Source/Project64-core/N64System/Mips/GBCart.cpp @@ -4,7 +4,6 @@ // Copyright(C) 2015 Bobby Smiles // GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html #include "stdafx.h" -#include #include "GBCart.h" #include @@ -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) { const struct parsed_cart_type* type; - AUTO_PTR rom; + std::unique_ptr rom; size_t rom_size = 0; - AUTO_PTR ram; + std::unique_ptr ram; size_t ram_size = 0; CFile tempFile; diff --git a/Source/Project64-core/N64System/N64DiskClass.cpp b/Source/Project64-core/N64System/N64DiskClass.cpp index c1e1c6cdb..dd8e4dc80 100644 --- a/Source/Project64-core/N64System/N64DiskClass.cpp +++ b/Source/Project64-core/N64System/N64DiskClass.cpp @@ -3,7 +3,6 @@ #include "SystemGlobals.h" #include #include -#include #include #include #include @@ -236,7 +235,7 @@ void CN64Disk::ClearDiskSettingID() bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize) { WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk"); - AUTO_PTR ImageBase(new uint8_t[DiskFileSize + 0x1000]); + std::unique_ptr ImageBase(new uint8_t[DiskFileSize + 0x1000]); if (ImageBase.get() == NULL) { SetError(MSG_MEM_ALLOC_ERROR); @@ -256,7 +255,7 @@ bool CN64Disk::AllocateDiskImage(uint32_t DiskFileSize) bool CN64Disk::AllocateDiskHeader() { WriteTrace(TraceN64System, TraceDebug, "Allocating memory for disk header forge"); - AUTO_PTR HeaderBase(new uint8_t[0x40 + 0x1000]); + std::unique_ptr HeaderBase(new uint8_t[0x40 + 0x1000]); if (HeaderBase.get() == NULL) { SetError(MSG_MEM_ALLOC_ERROR); diff --git a/Source/Project64-core/N64System/N64RomClass.cpp b/Source/Project64-core/N64System/N64RomClass.cpp index cde044d47..240790263 100644 --- a/Source/Project64-core/N64System/N64RomClass.cpp +++ b/Source/Project64-core/N64System/N64RomClass.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -31,7 +30,7 @@ CN64Rom::~CN64Rom() bool CN64Rom::AllocateRomImage(uint32_t RomFileSize) { WriteTrace(TraceN64System, TraceDebug, "Allocating memory for rom"); - AUTO_PTR ImageBase(new uint8_t[RomFileSize + 0x2000]); + std::unique_ptr ImageBase(new uint8_t[RomFileSize + 0x2000]); if (ImageBase.get() == NULL) { SetError(MSG_MEM_ALLOC_ERROR); diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 2cb46422a..739aec5ae 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include "Config.h" @@ -1167,7 +1166,7 @@ void newSwapBuffers() info.size = sizeof(gfxLfbInfo_t); if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GFX_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, false, &info)) { - AUTO_PTR ssimg_buffer(new uint8_t[image_width * image_height * 3]); + std::unique_ptr 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; diff --git a/Source/Project64/Support.h b/Source/Project64/Support.h index eb7f72cd1..02b2af543 100644 --- a/Source/Project64/Support.h +++ b/Source/Project64/Support.h @@ -9,6 +9,5 @@ #include #include #include -#include #include #include