Merge pull request #1453 from lioncash/str

GCMemcardDirectory: Pass std::strings by reference.
This commit is contained in:
comex 2014-10-31 16:07:46 -04:00
commit af1a08fbf3
2 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@
const int NO_INDEX = -1; const int NO_INDEX = -1;
static const char *MC_HDR = "MC_SYSTEM_AREA"; static const char *MC_HDR = "MC_SYSTEM_AREA";
int GCMemcardDirectory::LoadGCI(std::string fileName, DiscIO::IVolume::ECountry card_region, bool currentGameOnly) int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region, bool currentGameOnly)
{ {
File::IOFile gcifile(fileName, "rb"); File::IOFile gcifile(fileName, "rb");
if (gcifile) if (gcifile)
@ -131,7 +131,7 @@ int GCMemcardDirectory::LoadGCI(std::string fileName, DiscIO::IVolume::ECountry
return NO_INDEX; return NO_INDEX;
} }
GCMemcardDirectory::GCMemcardDirectory(std::string directory, int slot, u16 sizeMb, bool ascii, DiscIO::IVolume::ECountry card_region, int gameId) GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb, bool ascii, DiscIO::IVolume::ECountry card_region, int gameId)
: MemoryCardBase(slot, sizeMb) : MemoryCardBase(slot, sizeMb)
, m_GameId(gameId) , m_GameId(gameId)
, m_LastBlock(-1) , m_LastBlock(-1)
@ -652,7 +652,7 @@ void GCIFile::DoState(PointerWrap &p)
p.Do(m_used_blocks); p.Do(m_used_blocks);
} }
void MigrateFromMemcardFile(std::string strDirectoryName, int card_index) void MigrateFromMemcardFile(const std::string& strDirectoryName, int card_index)
{ {
File::CreateFullPath(strDirectoryName); File::CreateFullPath(strDirectoryName);
std::string ini_memcard = std::string ini_memcard =

View File

@ -9,12 +9,12 @@
// Uncomment this to write the system data of the memorycard from directory to disc // Uncomment this to write the system data of the memorycard from directory to disc
//#define _WRITE_MC_HEADER 1 //#define _WRITE_MC_HEADER 1
void MigrateFromMemcardFile(std::string strDirectoryName, int card_index); void MigrateFromMemcardFile(const std::string& strDirectoryName, int card_index);
class GCMemcardDirectory : public MemoryCardBase, NonCopyable class GCMemcardDirectory : public MemoryCardBase, NonCopyable
{ {
public: public:
GCMemcardDirectory(std::string directory, int slot = 0, u16 sizeMb = MemCard2043Mb, bool ascii = true, GCMemcardDirectory(const std::string& directory, int slot = 0, u16 sizeMb = MemCard2043Mb, bool ascii = true,
DiscIO::IVolume::ECountry card_region = DiscIO::IVolume::COUNTRY_EUROPE, int gameId = 0); DiscIO::IVolume::ECountry card_region = DiscIO::IVolume::COUNTRY_EUROPE, int gameId = 0);
~GCMemcardDirectory(); ~GCMemcardDirectory();
void FlushToFile(); void FlushToFile();
@ -26,7 +26,7 @@ public:
void DoState(PointerWrap &p) override; void DoState(PointerWrap &p) override;
private: private:
int LoadGCI(std::string fileName, DiscIO::IVolume::ECountry card_region, bool currentGameOnly); int LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region, bool currentGameOnly);
inline s32 SaveAreaRW(u32 block, bool writing = false); inline s32 SaveAreaRW(u32 block, bool writing = false);
// s32 DirectoryRead(u32 offset, u32 length, u8* destaddress); // s32 DirectoryRead(u32 offset, u32 length, u8* destaddress);
s32 DirectoryWrite(u32 destaddress, u32 length, u8 *srcaddress); s32 DirectoryWrite(u32 destaddress, u32 length, u8 *srcaddress);