diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-11-15 20:27:59 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-11-15 20:27:59 -0500 |
| commit | 5d2ca2dfcc051aab4c377d43dca82e6d0c17ced7 (patch) | |
| tree | d668f8711d63508105cb9196556ce0b7b8f3c9c9 /Source/Core | |
| parent | 43b8749c6086aaabbf241875b34c3d7a43f6a112 (diff) | |
| parent | 798a96bd2aa87d21570134a66130b12548262f8b (diff) | |
Merge pull request #1554 from lioncash/unique
ISOFile: Get rid of a delete call
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinWX/ISOFile.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp index 8e02f58ffc..1a8208c311 100644 --- a/Source/Core/DolphinWX/ISOFile.cpp +++ b/Source/Core/DolphinWX/ISOFile.cpp @@ -5,6 +5,7 @@ #include <cinttypes> #include <cstdio> #include <cstring> +#include <memory> #include <string> #include <vector> #include <wx/bitmap.h> @@ -80,30 +81,26 @@ GameListItem::GameListItem(const std::string& _rFileName) if (pFileSystem != nullptr || m_Platform == WII_WAD) { - DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem, pVolume); + std::unique_ptr<DiscIO::IBannerLoader> pBannerLoader(DiscIO::CreateBannerLoader(*pFileSystem, pVolume)); - if (pBannerLoader != nullptr) + if (pBannerLoader != nullptr && pBannerLoader->IsValid()) { - if (pBannerLoader->IsValid()) + if (m_Platform != WII_WAD) + m_banner_names = pBannerLoader->GetNames(); + m_company = pBannerLoader->GetCompany(); + m_descriptions = pBannerLoader->GetDescriptions(); + + std::vector<u32> Buffer = pBannerLoader->GetBanner(&m_ImageWidth, &m_ImageHeight); + u32* pData = &Buffer[0]; + // resize vector to image size + m_pImage.resize(m_ImageWidth * m_ImageHeight * 3); + + for (int i = 0; i < m_ImageWidth * m_ImageHeight; i++) { - if (m_Platform != WII_WAD) - m_banner_names = pBannerLoader->GetNames(); - m_company = pBannerLoader->GetCompany(); - m_descriptions = pBannerLoader->GetDescriptions(); - - std::vector<u32> Buffer = pBannerLoader->GetBanner(&m_ImageWidth, &m_ImageHeight); - u32* pData = &Buffer[0]; - // resize vector to image size - m_pImage.resize(m_ImageWidth * m_ImageHeight * 3); - - for (int i = 0; i < m_ImageWidth * m_ImageHeight; i++) - { - m_pImage[i * 3 + 0] = (pData[i] & 0xFF0000) >> 16; - m_pImage[i * 3 + 1] = (pData[i] & 0x00FF00) >> 8; - m_pImage[i * 3 + 2] = (pData[i] & 0x0000FF) >> 0; - } + m_pImage[i * 3 + 0] = (pData[i] & 0xFF0000) >> 16; + m_pImage[i * 3 + 1] = (pData[i] & 0x00FF00) >> 8; + m_pImage[i * 3 + 2] = (pData[i] & 0x0000FF) >> 0; } - delete pBannerLoader; } delete pFileSystem; |
