From a82675b7d581421fa80d5d5c53253cf1d5c1a26d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 12 Mar 2014 15:33:41 -0400 Subject: Kill off some usages of c_str. Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc). --- Source/Core/DiscIO/DriveBlob.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'Source/Core/DiscIO/DriveBlob.cpp') diff --git a/Source/Core/DiscIO/DriveBlob.cpp b/Source/Core/DiscIO/DriveBlob.cpp index 361a74abdd..eb72a143d3 100644 --- a/Source/Core/DiscIO/DriveBlob.cpp +++ b/Source/Core/DiscIO/DriveBlob.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "Common/Common.h" #include "Common/FileUtil.h" @@ -17,7 +18,7 @@ namespace DiscIO { -DriveReader::DriveReader(const char *drive) +DriveReader::DriveReader(const std::string& drive) { #ifdef _WIN32 SectorReader::SetSectorSize(2048); @@ -56,8 +57,10 @@ DriveReader::DriveReader(const char *drive) #endif } else - NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive); -} // DriveReader::DriveReader + { + NOTICE_LOG(DISCIO, "Load from DVD backup failed or no disc in drive %s", drive.c_str()); + } +} DriveReader::~DriveReader() { @@ -79,18 +82,20 @@ DriveReader::~DriveReader() #endif } -DriveReader *DriveReader::Create(const char *drive) +DriveReader* DriveReader::Create(const std::string& drive) { - DriveReader *reader = new DriveReader(drive); + DriveReader* reader = new DriveReader(drive); + if (!reader->IsOK()) { delete reader; return nullptr; } + return reader; } -void DriveReader::GetBlock(u64 block_num, u8 *out_ptr) +void DriveReader::GetBlock(u64 block_num, u8* out_ptr) { u8* const lpSector = new u8[m_blocksize]; #ifdef _WIN32 @@ -109,7 +114,7 @@ void DriveReader::GetBlock(u64 block_num, u8 *out_ptr) delete[] lpSector; } -bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8 *out_ptr) +bool DriveReader::ReadMultipleAlignedBlocks(u64 block_num, u64 num_blocks, u8* out_ptr) { #ifdef _WIN32 u32 NotUsed; -- cgit v1.2.3